<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateYsBarRoleUsersTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('bar_role_users', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('bar_id')->unsigned()->comment('当前用户所在的吧');
			$table->integer('role_id')->unsigned()->comment('当前用户所属的角色');
			$table->integer('user_id')->unsigned()->comment('当前用户所属的id');
			$table->timestamps();
			$table->unique(['bar_id','role_id','user_id']);
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('bar_role_users');
	}

}
